package org.proddevplm.business.dataAccess;

import java.util.HashMap;
import java.util.Map;

import org.proddevplm.business.api.IAdapter;
import org.proddevplm.business.dataAccess.constants.DataAccessConstants;
import org.proddevplm.helpers.ManagerUtil;

public class DataAccessAdapter implements IAdapter{

	@Override
	public Object adapt(int command, Map<String, Object> dataObject) {
		
		Object adaptedObject = null;
		Map<String, Object> dataAccessMap = new HashMap<String, Object>();
		
		switch (command){
		
		case DataAccessConstants.COMPETITORS:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.SWOT:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
		
		case DataAccessConstants.SWOT_AJAX_CALL_1:
			
			dataAccessMap.put("competitor", ManagerUtil.getStringFromReq(dataObject.get("competitor")));
			adaptedObject = dataAccessMap;
			break;
		
		case DataAccessConstants.SWOT_AJAX_CALL_2:
			dataAccessMap.put("product", ManagerUtil.getStringFromReq(dataObject.get("product")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.STAKEHOLDERS:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.NEEDS_REQS_INTERN:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.EDIT_REQ_INFO:
			dataAccessMap.put("requirement", ManagerUtil.getStringFromReq(dataObject.get("requirement")));
			adaptedObject = dataAccessMap;
			break;
		
		case DataAccessConstants.PRIORITIZATION:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			dataAccessMap.put("elements", ManagerUtil.getStringFromReq(dataObject.get("elements")));
			dataAccessMap.put("matrixSize", ManagerUtil.getStringFromReq(dataObject.get("matrixSize")));
			adaptedObject = dataAccessMap;			
			break;
			
		case DataAccessConstants.VOCT:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.FUNCTIONS:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.CTQ:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.DE:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.SHOW_SWOT:
			dataAccessMap.put("swotRequestName", ManagerUtil.getStringFromReq(dataObject.get("swotRequestName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.CHECK_SWOT_STATUS:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
						
		case DataAccessConstants.GET_CHANGES:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.GET_UNIQUE_REPORT:
			dataAccessMap.put("id", ManagerUtil.getStringFromReq(dataObject.get("id")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.PUGH:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.GET_PUGH:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.CORRELATION_MATRIX:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.DFX:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.GET_GUIDELINES:
			dataAccessMap.put("dfxId", ManagerUtil.getStringFromReq(dataObject.get("dfxId")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.GET_SPECIFIC_GUIDELINE:
			dataAccessMap.put("dfxGId", ManagerUtil.getStringFromReq(dataObject.get("dfxGId")));
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.POPULATE_G_TABLE:
			String dfxIds = ManagerUtil.getStringFromReq(dataObject.get("dfxIds"));
			String[] Ids = dfxIds.split("~");
			dataAccessMap.put("dfxIds", Ids);
			
			adaptedObject = dataAccessMap;
			break;
			
		case DataAccessConstants.EXTERNAL_TOOL:
			dataAccessMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = dataAccessMap;
			break;
			
			
		}
		
		return adaptedObject;
	}

}
